home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / Strong_BS175.ZIP / !StrongBS / Resources / Crunch / !Help < prev    next >
Text File  |  1997-04-21  |  9KB  |  163 lines

  1. Help file for the BASS Cruncher application (version 1.30).
  2. -----------------------------------------------------------
  3.  
  4. This program is FREEWARE: it may be freely copied and used as long as all the files are unaltered and the application is not sold for profit etc. Putting it on a public file server is okay. You're also allowed to use your crunched files and the Decrunch module where you want, even in commercials... Of course I cannot be held responsible for any data loss... Use of the Decrunch module in commercial products is allowed at the conditions that 1) You don't claim the module is your work, and 2) You don't sell the module for itself, so only the contents of your work can justify the price...
  5.  
  6. *Important*: This is NOT an archiver! The files created are crunched and stay crunched for ever, at least for executables!
  7.  
  8. This application is the multitaking version of an old tiny executable made by me to compress executables just as Acorn's Squeeze does, but usually more efficiently when mixed data is involved. The latest non multitasking very non user friendly version was 'CrunchC030'. By the way, the very first version was a conversion from the CBM64...
  9.  
  10. Now the interface and the algorithms have been completly reworked in order to be easy to use and fast. Those who used the older version will notice the difference in compression speed.
  11.  
  12. The application works fully multitasking with the interface looking like RISC OS 3 filer operations windows...
  13.  
  14. As a bonus, clicking ADJUST on the Cruncher icon will bring a RM merger window. It allows to build an executable that'll install a given number of modules in RMA when run. Of course you can later compress it with Cruncher to gain disk space.
  15.  
  16. However, it is probable that this program will not be of full interest to real users, but would rather be enjoyed by real programmers.
  17.  
  18. Features
  19. --------
  20. - Launch the !Help application for more info.
  21. - Should work on all versions of RISC OS and all ARM processors, although it has been tested only on RISC OS 3.11, 3.5 and 3.7 (StrongARM).
  22. - Should work on any configuration, like floppy-only (like me!) or 1Meg-only.
  23. - Can handle a selection of files dragged to its iconbar icon. Files to crunch are simply queued until the current crunch job is finished. This method is more efficient than crunching all the files in parallel, both in the point of view of file access (seek time) and memory usage (have you noticed how multiple filer operations are slow and memory hungry on RISC OS 3?)
  24. - You can alter a parameter in the !Run file to set the maximum memory claimable by Cruncher: more memory speeds up the algorithm a LITTLE bit and could be an advantage when filing is on floppy. You can also set it to the minimum since in that case the application will only grab the minimum memory it really needs.
  25. - When dragged to !Crunch, Absolute, load/exec, BASIC, Module and Sprite files are crunched and converted to Absolute type.
  26. - Depending on your choice at crunch time, crunched files can later either be run or uncrunched using the SWI's provided by the Decrunch module to be found in this application directory.
  27. - Restrictions: when crunching sprites, only a screen dump of the right width and no wastage and no mask will be handled correctly. Tip: if a crunched screen gets the colours wrong then: 1) *ScreenLoad the original, 2) *ScreenSave to something, and 3) Crunched that something. It should work.
  28. - Reliability: it's possible for a file containing no compressable data at its start to not decrunch properly, although I've not seen such until now. So always check it runs as it should!
  29. - !Crunch is callable from the CLI.
  30.  
  31. Some tricks from control window
  32. -------------------------------
  33. - The exec address can be entered relative to the load address by prefixing with a '+'.
  34. - When crunching a data file, the output is forced to data type. In that case the exec address field provides the default load address of the data.
  35. - When crunching files other than data, giving an 'Other' load address of zero produces a data file. In that case an 'Other' or the filetype default exec address also sets the reload address of data.
  36.  
  37. Technical details
  38. -----------------
  39. - The decompression code uses only at most 604 bytes at the decompressed data
  40.   top. It doesn't need any extra workspace.
  41. - All is written in pure ARM code.
  42. - When running the decompression routine is in SVC mode with interrupts
  43.   unaltered. R13's registers are not used and not corrupted. On exit processor
  44.   mode and interrupts and R13 are unaltered, the rest is corrupted.
  45.  
  46. About efficiency: usually more efficient than Squeeze or any LZW algorithm when mixed code is involved, I mean something like demo or application code. LZW can be a little bit better on pictures and Squeeze a little bit better on ARM-code-only data. In fact I noticed recently that my algorithm is a kind of LZ77 compression scheme!
  47.  
  48. Decompression speed: it IS FAST. I think I can't make it faster since all registers are fully used... It's not as fast as Squeeze since it's byte oriented; Squeeze is word oriented so it can use LDM/STM but the drawback is 'lack' of compression efficiency.
  49.  
  50. Arguments to provide when run from the CLI
  51. ------------------------------------------
  52. !Crunch may be run from the CLI. Just run the 'Crunch' file found inside the !Crunch application.
  53.  
  54. The syntax is:
  55.  
  56. Crunch [options] <source file> <destination file>
  57.  
  58. Options are:
  59.   -a            Force absolute
  60.   -f            Force production of crunched data only
  61.   -lf           Load address from file (default)
  62.   -lo<addr>     Load address = <addr>
  63.   -xf           Exec address from file (default)
  64.   -xx           Exec address is SWI OS_Exit
  65.   -xr           Exec address from R14
  66.   -xo[+]<addr>  Exec address = <addr> or <load addr> + <addr>
  67.  
  68. Decrunch module SWI's
  69. ---------------------
  70.  
  71. --- Decrunch_Decrunch (SWI &C0AC0) ---
  72.  
  73. Decrunch crunched data
  74.  
  75. Entry: R0= % b4 b3 b2 b1 b0 (flags, other bits must be 0)
  76.            b4= force destination address
  77.            b3= use hourglass
  78.            b2= decrunch data from memory
  79.            b1= use a file handle instead of a filename pointer
  80.            b0= assume magic string not present
  81.        R1: case b2 b1
  82.                  0  0 : R1= source filename pointer
  83.                  0  1 : R1= source file handle
  84.                  1  0 : R1= pointer to source data in memory
  85.                  1  1 : Undefined behaviour
  86.        R2: case b4= 1 : R2= destination address in memory
  87.                 b4= 0 : R2= irrelevant
  88.  
  89. Exit:  if V set then R0= pointer to RISC OS error block
  90.                      other registers preserved
  91.                      file pointer unchanged (if using file handle)
  92.        else
  93.        R0 preserved
  94.        R1= case b2 b1
  95.                  0  0 : R1 preserved
  96.                  0  1 : R1 preserved
  97.                         file pointer advanced for further use
  98.                  1  0 : R1 points to the end of source data for further use
  99.        R2= load address found in the source data
  100.        R3= length of uncrunched data
  101.  
  102.        All else is preserved
  103.  
  104. Processor mode: the decompressor works in SVC mode so you can decrunch to protected memory.
  105.  
  106. --- Decrunch_Get (SWI &C0AC1) ---
  107.  
  108. Get information about crunched data.
  109.  
  110. Entry: R0= % b3 b2 b1 b0 (flags, other bits must be 0)
  111.            b3= use hourglass
  112.            b2= decrunch data from memory
  113.            b1= use a file handle instead of a filename pointer
  114.            b0= assume magic string not present
  115.        R1: case b2 b1
  116.                  0  0 : R1= source filename pointer
  117.                  0  1 : R1= source file handle
  118.                  1  0 : R1= pointer to source data in memory
  119.                  1  1 : Undefined behaviour
  120.  
  121. Exit:  if V set then R0= pointer to RISC OS error block
  122.                      other registers preserved
  123.                      file pointer unchanged (if using file handle)
  124.        else
  125.        R0, R1 preserved
  126.        R2= load address found in the source data
  127.        R3= length of uncrunched data
  128.  
  129.        File pointer unchanged (if using file handle)
  130.  
  131.        All else is preserved
  132.  
  133. The latter SWI is fast because the data does not need to be uncrunched to get information about uncrunched data.
  134.  
  135. Beside RISC OS errors, both SWI's can also return a special Decrunch error indicating that the source data format is not recognized:
  136.  
  137.    Error number &C0AC0: Data not crunched
  138.  
  139.  
  140. --- Notes ---
  141.  
  142. Decrunching from memory:
  143.     The source data must not overlap with the space where the uncrunched data is put.
  144.  
  145. Skipping the magic string:
  146.     At the start of each data file produced by !Crunch there is an 8-byte magic string so that Decrunch can check whether it can cope with the file. You can bypass that check when you use "unmagical" files (i.e. with the first 8 bytes removed) by setting bit 0 of the flags.
  147.     However, using files with no magic string does not allow Decrunch to check for newer versions of the format and compression scheme, and so these files won't be compatible with such newer decrunchers.
  148.  
  149. Memory:
  150.     The decruncher does not requires any extra memory when decrunching.
  151.  
  152.  
  153.  
  154.  
  155. That's it for now... I hope (and I've already heard) that you enjoy !Crunch and hello to other cool hackers! (and not to lame crackers)
  156.  
  157. --
  158. The latest version of !Crunch can be found at:
  159.                 http://www.fun.cediti.be/~bju/myprogs.html
  160.  
  161. My email address: bju@fun.cediti.be
  162.  
  163. Bernard Jungen for BASS, February 1994/June 1995/November 1996/April 1997.